package com.suntront.module_metertask.meterdetail

import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mtjsoft.www.kotlinmvputils.base.BaseRecycleviewActivity
import com.mtjsoft.www.kotlinmvputils.base.BaseRecycleViewModel
import com.mtjsoft.www.kotlinmvputils.constants.RouterConstants
import com.suntront.lib_db.table.UserT
import com.suntront.module_metertask.R

import com.suntront.module_metertask.adapter.MeterDetailAdapter

/**
 * @author mtj
 * @Package com.suntront.module_metertask.meterdetail
 * @date 2020-06-01 08:59:56
 */
@Route(path = RouterConstants.MeterTask_UserTDetail)
class MeterDetailRecycleViewActivity : BaseRecycleviewActivity<UserT, MeterDetailViewModel>() {

    /**
     * 注入路由传递的参数
     * rosterId  表册id
     */
    @JvmField
    @Autowired
    var rosterId = 0

    override fun providerVMClass(): Class<MeterDetailViewModel>? {
        return MeterDetailViewModel::class.java
    }

    override fun loadActivityInfo() {
        setPageTitle(resources.getString(R.string.meterdetail_title))
        viewModel.refresh.value = false
        viewModel.load_more.value = false
        viewModel.rosterId = rosterId
    }

    override fun setItemDecoration(): Int {
        return 0
    }

    override fun setPageSize(): Int {
        return Int.MAX_VALUE
    }

    override fun setLayoutManagerType(): BaseRecycleViewModel.LayoutManager {
        return BaseRecycleViewModel.LayoutManager.LinearLayoutManager
    }

    override fun setCount(): Int {
        return 2
    }

    override fun instanceAdapter(list: MutableList<UserT>): BaseQuickAdapter<UserT, BaseViewHolder> {
        return MeterDetailAdapter(getContext(), list)
    }

}